home *** CD-ROM | disk | FTP | other *** search
-
-
-
- LLLLDDDDOOOOPPPPEEEENNNN((((3333XXXX)))) LLLLDDDDOOOOPPPPEEEENNNN((((3333XXXX))))
-
-
-
- NNNNAAAAMMMMEEEE
- ldopen, ldaopen - open a common object file for reading
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<ffffiiiilllleeeehhhhddddrrrr....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyymmmmssss....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<llllddddffffccccnnnn....hhhh>>>>
-
- LLLLDDDDFFFFIIIILLLLEEEE ****llllddddooooppppeeeennnn ((((filename, ldptr))))
- cccchhhhaaaarrrr ****filename;;;;
- LLLLDDDDFFFFIIIILLLLEEEE ****ldptr;;;;
-
- LLLLDDDDFFFFIIIILLLLEEEE ****llllddddaaaaooooppppeeeennnn ((((filename, oldptr))))
- cccchhhhaaaarrrr ****filename;;;;
- LLLLDDDDFFFFIIIILLLLEEEE ****oldptr;;;;
-
- iiiinnnntttt llllddddrrrreeeeaaaaddddsssstttt ((((ldptr, flags))))
- LLLLDDDDFFFFIIIILLLLEEEE ****ldptr;
- iiiinnnntttt flags;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _l_d_o_p_e_n and _l_d_c_l_o_s_e(3X) provide uniform access to simple object files and
- to object files that are members of archive files. An archive of common
- object files can be processed as if it were a series of simple common
- object files.
-
- If _l_d_p_t_r has the value NNNNUUUULLLLLLLL, _l_d_o_p_e_n opens _f_i_l_e_n_a_m_e, allocates and
- initializes the LLLLDDDDFFFFIIIILLLLEEEE structure, and returns a pointer to the structure
- to the calling program.
-
- If _l_d_p_t_r is valid and TTTTYYYYPPPPEEEE((((_l_d_p_t_r)))) is the archive magic number, _l_d_o_p_e_n
- reinitializes the LLLLDDDDFFFFIIIILLLLEEEE structure for the next archive member of
- _f_i_l_e_n_a_m_e.
-
- _l_d_o_p_e_n and _l_d_c_l_o_s_e work in concert. _l_d_c_l_o_s_e returns FFFFAAAAIIIILLLLUUUURRRREEEE only when
- TTTTYYYYPPPPEEEE((((_l_d_p_t_r)))) is the archive magic number and there is another file in the
- archive to be processed. Only then should _l_d_o_p_e_n be called with the
- current value of _l_d_p_t_r. In all other cases, and particularly when a new
- _f_i_l_e_n_a_m_e is opened, _l_d_o_p_e_n should be called with a NNNNUUUULLLLLLLL _l_d_p_t_r argument.
-
- The following is a prototype for the use of _l_d_o_p_e_n and _l_d_c_l_o_s_e. It
- handles individual object (or a.out) files and (via the while-loop) an
- archive file (see ar(1)) of object files.
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- LLLLDDDDOOOOPPPPEEEENNNN((((3333XXXX)))) LLLLDDDDOOOOPPPPEEEENNNN((((3333XXXX))))
-
-
-
- /* for each filename to be processed */
-
- ldptr = NULL;
- do {
- if ( (ldptr = ldopen(filename, ldptr)) != NULL )
- {
- /* check magic number */
- /* process a single object file */
- }
- } while (ldclose(ldptr) == FAILURE );
-
- If the value of _o_l_d_p_t_r is not NNNNUUUULLLLLLLL, _l_d_a_o_p_e_n opens _f_i_l_e_n_a_m_e anew and
- allocates and initializes a new LLLLDDDDFFFFIIIILLLLEEEE structure, copying the fields from
- _o_l_d_p_t_r. _l_d_a_o_p_e_n returns a pointer to the new LLLLDDDDFFFFIIIILLLLEEEE structure. This new
- pointer is independent of the old pointer, _o_l_d_p_t_r. The two pointers can
- be used concurrently to read separate parts of the object file. For
- example, one pointer can be used to step sequentially through the
- relocation information while the other is used to read indexed symbol
- table entries.
-
- _l_d_o_p_e_n and _l_d_a_o_p_e_n open _f_i_l_e_n_a_m_e for reading. If _f_i_l_e_n_a_m_e cannot be
- opened or if memory for the LLLLDDDDFFFFIIIILLLLEEEE structure cannot be allocated, both
- functions return NNNNUUUULLLLLLLL. A successful open does not ensure that the given
- file is a common object file or an archived object file. When calling
- _l_d_o_p_e_n on a given a.out (rather than an archive) for the first time be
- sure the second argument you pass is a NULL pointer ((LDFILE *)0) (this
- is the only way to ensure the LDFILE * is initialized properly for that
- a.out).
-
- _l_d_r_e_a_d_s_t reads in the portions of the symbol table implied by the _f_l_a_g_s
- argument. A _f_l_a_g_s argument of ----1111 reads in the entire symbol table.
- Since the other routines, for example _l_d_t_b_r_e_a_d, ensure that the relevant
- portions of the symbol table have been read in, you need not call
- _l_d_r_e_a_d_s_t to use the other routines. _l_d_r_e_a_d_s_t(_l_d_p_t_r,-_1) would simply
- ensure the whole symbol table is read in at once, which is not necessary.
- _l_d_r_e_a_d_s_t returns SSSSUUUUCCCCCCCCEEEESSSSSSSS if it has read in the symbol table successfully
- or FFFFAAAAIIIILLLLUUUURRRREEEE if it cannot. If an symbol table has been truncated or
- damaged there is a small probability that _l_d_r_e_a_d_s_t will core dump rather
- than return FFFFAAAAIIIILLLLUUUURRRREEEE ....
-
- _l_d_o_p_e_n causes the symbol table header and file descriptor table to be
- read. Further access, using _l_d_p_t_r, causes other appropriate sections of
- the symbol table to be read (for example, if you call _l_d_t_b_r_e_a_d, _t_h_e
- _s_y_m_b_o_l_s _o_r _e_x_t_e_r_n_a_l_s _a_r_e _r_e_a_d). _T_o _f_o_r_c_e _s_e_c_t_i_o_n_s _o_f _t_h_e _s_y_m_b_o_l _t_a_b_l_e
- _i_n_t_o _m_e_m_o_r_y, _c_a_l_l _l_d_r_e_a_d_s_t with _S_T__P* constants ORed together from
- <_c_m_p_l_r_s/_s_t_s_u_p_p_o_r_t._h>.
-
- The program must be loaded with the object file access routine library
- lllliiiibbbbmmmmlllldddd....aaaa.
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- LLLLDDDDOOOOPPPPEEEENNNN((((3333XXXX)))) LLLLDDDDOOOOPPPPEEEENNNN((((3333XXXX))))
-
-
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- fopen(3S), ldclose(3X), ldfcn(4).
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-